package com.java.thread.exer1;

/**
 * @author luzhikun
 * @date &{DATE} &{TIME}
 */
/*
 * 练习：创建两个分线程，一个线程去遍历100以内的奇数，另外一个线程遍历100以内的偶数
 *
 * */
public class ThreadTest_1 {
    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start();
        MyThread1 myThread1 = new MyThread1();
        myThread1.start();
    }
}

class MyThread extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if (i % 2 == 0) {
                System.out.println("这是偶数" + i);
            }
        }
    }
}

class MyThread1 extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if (i % 2 != 0) {
                System.out.println("这是奇数" + i);
            }
        }
    }
}